﻿@inject IStringLocalizer<Toggles> Localizer

<div class="row g-3">
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="@BindValue" ValueChanged="@OnValueChanged" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Primary" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="true" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Secondary" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="true" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Success" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="true" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Danger" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="true" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Warning" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="true" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Info" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="true" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Dark" />
    </div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto">
        <Toggle Value="false" OnText="@Localizer["TogglesOnText"]" OffText="@Localizer["TogglesOffText"]" Color="Color.Success" />
    </div>
</div>
<ConsoleLogger @ref="Logger" class="mt-3" />

@code {
    private bool BindValue { get; set; } = true;

    [NotNull]
    private ConsoleLogger? Logger { get; set; }

    private void OnValueChanged(bool val)
    {
        BindValue = val;
        Logger.Log($"Toggle CurrentValue: {val}");
    }
}
